import Vue from 'vue'
import App from './App'
import store from './store'

export const _this = Vue.prototype

_this.$store = store

_this.$bus = new Vue()

import api from './api'
_this.$api = api

import moment from 'moment'
moment.locale('zh-cn')
_this.$moment = function (date, fmt = 'YYYY/MM/DD HH:mm') {
  if (!date) {
    return '--'
  } else {
    return moment(date).format(fmt)
  }
}

// npm i -D sass-loader@8 node-sass@4
import uView from 'uview-ui'
Vue.use(uView)

import infoText from './component/infoText'
Vue.component('infoText', infoText)

import topBar from './component/topBar'
Vue.component('topBar', topBar)

import popWrap from './component/popWrap'
Vue.component('popWrap', popWrap)

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
  ...App,
})
app.$mount()
